replace first occurrence of character in string c#

62

replace first occurrence of character in string c# -

var regex = new Regex(Regex.Escape("o"));
var newText = regex.Replace("Hello World", "Foo", 1);

Comments

Submit
0 Comments